<?
//获取指定数据:
//$belong 所属板块
//$sort_by:排序项,例："nid,listorder desc"
//$term:分类的id
//number:获取数据数量,0则无限
//publish是必须

function get_detail_list_by_term($belong,$sortby,$term,$number)
{

    global $table_Prefix;
    global $sys_list_table;

//设置需要搜索的表格的前缀后缀
    $table_Suffix = $sys_list_table;
    $table        = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀


//分类id存在，统计数目就是统计relation表格，因为relation有term_id项目


//设置需要搜索的表格的前缀后缀
    $table_Suffix = "relation";
    $table        = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀


    $detail_id_list_str = "select * from " . $table . " where term_nid = '" . $term . "' ";


    $resultsum = mysql_query($detail_id_list_str);


    while ($row = mysql_fetch_array($resultsum)) {
        $relation_detail_nid[] = $row['detail_nid'];
    }


    $table_Suffix = "detail";
    $tableDetail  = $table_Prefix . $table_Suffix;


    for ($n = 0; $n < count($relation_detail_nid); $n++) {


         $sqlstr="SELECT * FROM ".$tableDetail." where nid = '".$relation_detail_nid[$n]."'".$sort_str.$limit_str;

        $detail_list = mysql_query($sqlstr);
        while ($row = mysql_fetch_array($detail_list)) {
            $detail['nid'][]  = $row['nid'];
            $detail['icon'][] = $row['icon'];
            $detail['link'][] = $row['link'];
            $detail['name'][] = $row['name'];
        }
    }

    return $detail;
}
?>

